﻿<%@ Page Title="" Language="C#" MasterPageFile="~/module/Fontend.Master" AutoEventWireup="true" CodeBehind="ParentConversation.aspx.cs" Inherits="mamnontuoitho7.module.ParentConversation"  ValidateRequest="false"  %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
<script language="javascript" type="text/javascript">

    function ConversationTopic_Click() {

        var commentContent = trim(document.getElementById("<%= txtConversation.ClientID %>").value);
        var leng = commentContent.length;
        if (leng < 4 || leng > 600) {
            alert("Cần gõ hơn 4 ký tự và không quá 600 ký tự");
            return false;
        }
    }
    function trim(str) {
        return str.replace(/^\s+|\s+$/g, "");
    }
    </script>

<div class="accounts">
    <div class="login-name">
        <div class="login-name-left"></div>
        <span class="login-name-middle"><%= Session["fullname"].ToString()%></span>
        <div class="login-name-right"></div>
    </div>
    
    <div class="block-menu">
        <ul>
            <li class="active">Các cuộc hội thoại</li>
            <li><a href="ParentKidList.aspx">Danh sách Bé</a></li>
            <li><a href="ParentWarning.aspx">Thông báo</a></li>
            <li><a href="ParentProfile.aspx">Thông tin tài khoản</a></li>
            <li><a href="ChangeAvatar.aspx">Thay đổi Avatar</a></li>
        </ul>
    </div>
    
    <div class="block-content">
    <% if (_parent.CheckParentAvailability(Session["memberID"].ToString()) == "2")
       { %>
        <form id="form1" runat="server">
            <div class="blockform">
            <h1 class="send-conversation">Viết cuộc thoại mới cho giáo viên lớp:
                <asp:DropDownList ID="ddlClass" runat="server" style="border:none; background:none; color:#000066;">
                </asp:DropDownList>
            </h1>
            <% if (_classCount!=0)
               { %>
            <asp:TextBox ID="txtConversation" runat="server" TextMode="MultiLine"></asp:TextBox><br />
            <asp:Button ID="btnConversationSend" runat="server" CssClass="buttons" 
                Text="Gửi" onclick="btnConversationSend_Click" OnClientClick="return ConversationTopic_Click()"/>
            <%} %>
        </div>
        </form>

        <div class="blocktable">
            <h1 class="list-conversation">Các cuộc hội thoại:</h1>
            <table width="100%">
                <tr>
                    <td>
                        <table cellpadding="0" cellspacing="0" border="0" id="table" class="tinytable">
                            <thead>
                                <tr>
                                    <!--vị trí header list-->
                                    <%--<th>
                                        <h3>
                                            <asp:Label ID="Label5" runat="server" Text='Mã số'></asp:Label></h3>
                                    </th>--%>
                                    <th>
                                        <h3>
                                            <asp:Label ID="Label6" runat="server" Text='Tiêu đề'></asp:Label></h3>
                                    </th>
                                    
                                    
                                    <th>
                                        <h3>
                                            <asp:Label ID="Label2" runat="server" Text='Lớp'></asp:Label></h3>
                                    </th>
                                     <th>
                                        <h3>
                                            <asp:Label ID="Label1" runat="server" Text='Ngày'></asp:Label></h3>
                                    </th>
                                   
                                   
                                </tr>
                            </thead>
                            <tbody>
                                <!--vị trí content list-->
                                <%
        /* write code get datatable show into for loop */
        for (int i = 0; i < _dt.Rows.Count; i++)
        {
            if (_dt.Rows[i]["IsReadOwner"].ToString() == "False")
            {
                                %>
                                <tr style="background:#CFF;">
                                <%}
            else
            {%>
                                <tr>
                                <%} %>
                                    <%--<td style="width: 70px;">
                                        <%=_dt.Rows[i]["ConversationID"].ToString()%>
                                    </td>--%>
                                    <td>
                                    <a href="ParentConversationDetails.aspx?ConversationID=<%=_dt.Rows[i]["ConversationID"].ToString()%>">
                                        <%=_general.ReplaceSpecialCharacters(_general.CutString(_dt.Rows[i]["Topic"].ToString(), 220))%>
                                        </a>
                                    </td>
                                    
                                    
                                    <td style="width: 30px;text-align:center;">
                                        <%=_dt.Rows[i]["ClassName"].ToString()%> 
                                    </td>
                                    <td style="width: 50px;">
                                      <%= DateTime.Parse(_dt.Rows[i]["CreateDate"].ToString()).ToString("dd/MM/yyyy")%>
                                    </td>
                                </tr>
                                <% } %>
                            </tbody>
                        </table>
                    </td>
                </tr>
            </table>
        </div>  
    
     <div id="container">
        <div class="pagination">
            <%if (_currentbar > 1)
              { %>
            <a href="ParentConversation.aspx?a=-1" class="pageblue"><<</a>
            <%} %>
            <%  

        for (int j = _beginPage; j <= _endPage; j++)
        {
            if (j == _pageflag)
            {
            
            %>
            <a href="ParentConversation.aspx?page=<%= j%>" class="pageblue active"><%= j%></a>
            <% }
            else
            { %>
            <a href="ParentConversation.aspx?page=<%= j%>" class="pageblue"><%= j%></a>
            <%  }
        } %>
            <%if (_currentbar < _totalBars)
              { %>
            <a href="ParentConversation.aspx?a=1" class="pageblue">>></a>
            <%} %>
        </div>
    </div>
    <%}
       else { 
       %>
        <p class="commingsoon">Bạn không có bé nào đang học tại trường.</p>
       <%
       }%>
    </div>
</div>
</asp:Content>
